package graph;

public class Edge {

    private final Vertex     dest;   // Second vertex in Edge
    private final Vertex     sour;
    private final double     cost;   // Edge cost
    
    public Edge( Vertex v1, Vertex v2, double c )
    {
        sour = v1;
        dest = v2;
        cost = c;
    }
    
    public Vertex getVertex1(){
        return sour;
    }
    public Vertex getVertex2(){
        return dest;
    }
    
    public double getCost(){
        return cost;
    }
    
    
    public String toString(){
        return sour + " " + dest + " " + cost;
    }

    public boolean equals(Edge the_other){

        if(the_other != null)
            return (sour == the_other.getVertex1() && dest == the_other.getVertex2() && cost == the_other.getCost()) ||
                    (sour == the_other.getVertex2() && dest == the_other.getVertex1() && cost == the_other.getCost());
        else return false;
    }
    



}
